<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Python基础 -->
<!-- Start book Python基础 -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>输出语句 | Python基础</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="姜伟">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="chapter12.html" />
    
    
    <link rel="prev" href="chapter10.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="11"
        data-chapter-title="输出语句"
        data-filepath="chapter11.md"
        data-basepath="."
        data-revision="Mon Feb 03 2020 11:09:50 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter01.html">
            
                
                    <a href="chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        计算机组成
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        什么是编程语言
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Python语言介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        安装配置Python
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        开发工具介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Pycharm的基本使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="chapter07.html">
            
                
                    <a href="chapter07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        交互式编程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="chapter08.html">
            
                
                    <a href="chapter08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        注释的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="chapter09.html">
            
                
                    <a href="chapter09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        变量及数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10" data-path="chapter10.html">
            
                
                    <a href="chapter10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        标识符和关键字
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="11" data-path="chapter11.html">
            
                
                    <a href="./chapter11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        输出语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="chapter12.html">
            
                
                    <a href="chapter12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        输入语句
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="" >Python基础</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x8F93;&#x51FA;">&#x8F93;&#x51FA;</h1>
<p>&#x7B80;&#x5355;&#x6765;&#x8BF4;&#xFF0C;&#x5C31;&#x662F;&#x5C06;&#x7A0B;&#x5E8F;&#x7684;&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x663E;&#x793A;&#x51FA;&#x6765;&#x3002;</p>
<h2 id="&#x4E00;&#x3001;&#x666E;&#x901A;&#x7684;&#x8F93;&#x51FA;">&#x4E00;&#x3001;&#x666E;&#x901A;&#x7684;&#x8F93;&#x51FA;</h2>
<ul>
<li>&#x751F;&#x6D3B;&#x4E2D;&#x7684;&#x201C;&#x8F93;&#x51FA;&#x201D;
<img src="imgs/&#x7535;&#x5F71;&#x8F93;&#x51FA;.png" alt=""></li>
<li>&#x8F6F;&#x4EF6;&#x4E2D;&#x7684;&#x56FE;&#x5F62;&#x5316;&#x754C;&#x9762;&#x8F93;&#x51FA;
<img src="imgs/GUI&#x8F93;&#x51FA;.jpg" alt=""></li>
<li>python&#x4E2D;&#x53D8;&#x91CF;&#x7684;&#x8F93;&#x51FA;</li>
</ul>
<pre><code class="lang-python">print(<span class="hljs-string">&apos;hello world&apos;</span>)
</code></pre>
<h2 id="&#x4E8C;&#x3001;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;">&#x4E8C;&#x3001;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;</h2>
<h3 id="&#x683C;&#x5F0F;&#x5316;&#x64CD;&#x4F5C;&#x7684;&#x76EE;&#x7684;">&#x683C;&#x5F0F;&#x5316;&#x64CD;&#x4F5C;&#x7684;&#x76EE;&#x7684;</h3>
<p>&#x6BD4;&#x5982;&#x6709;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;:</p>
<pre><code class="lang-python">pirnt(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;10&#x5C81;&quot;</span>)
pirnt(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;11&#x5C81;&quot;</span>)
pirnt(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;12&#x5C81;&quot;</span>)
</code></pre>
<ul>
<li>&#x60F3;&#x4E00;&#x60F3;:</li>
</ul>
<blockquote>
<p>&#x5728;&#x8F93;&#x51FA;&#x5E74;&#x9F84;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x7528;&#x4E86;&#x591A;&#x6B21;&quot;&#x6211;&#x4ECA;&#x5E74;xx&#x5C81;&quot;&#xFF0C;&#x80FD;&#x5426;&#x7B80;&#x5316;&#x4E00;&#x4E0B;&#x7A0B;&#x5E8F;&#x5462;&#xFF1F;&#xFF1F;&#xFF1F;</p>
</blockquote>
<ul>
<li>&#x7B54;:</li>
</ul>
<blockquote>
<p>&#x5B57;&#x7B26;&#x4E32;&#x683C;&#x5F0F;&#x5316;</p>
</blockquote>
<h3 id="&#x4EC0;&#x4E48;&#x662F;&#x683C;&#x5F0F;&#x5316;">&#x4EC0;&#x4E48;&#x662F;&#x683C;&#x5F0F;&#x5316;</h3>
<p>&#x770B;&#x5982;&#x4E0B;&#x4EE3;&#x7801;:</p>
<pre><code class="lang-python">age = <span class="hljs-number">10</span>
print(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;%d&#x5C81;&quot;</span> % age)

age += <span class="hljs-number">1</span>
print(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;%d&#x5C81;&quot;</span> % age)

age += <span class="hljs-number">1</span>
print(<span class="hljs-string">&quot;&#x6211;&#x4ECA;&#x5E74;%d&#x5C81;&quot;</span> % age)
</code></pre>
<p>&#x5728;&#x7A0B;&#x5E8F;&#x4E2D;&#xFF0C;&#x770B;&#x5230;&#x4E86;%&#x8FD9;&#x6837;&#x7684;&#x64CD;&#x4F5C;&#x7B26;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;Python&#x4E2D;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x3002;</p>
<pre><code class="lang-python">age = <span class="hljs-number">18</span>
name = <span class="hljs-string">&quot;xiaohua&quot;</span>
print(<span class="hljs-string">&quot;&#x6211;&#x7684;&#x59D3;&#x540D;&#x662F;%s, &#x5E74;&#x9F84;&#x662F;%d&quot;</span> % (name, age))
</code></pre>
<h3 id="&#x5E38;&#x7528;&#x7684;&#x683C;&#x5F0F;&#x7B26;&#x53F7;">&#x5E38;&#x7528;&#x7684;&#x683C;&#x5F0F;&#x7B26;&#x53F7;</h3>
<p>&#x4E0B;&#x9762;&#x662F;&#x5B8C;&#x6574;&#x7684;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x4E0E;&#xFF05;&#x7B26;&#x53F7;&#x4F7F;&#x7528;&#x5217;&#x8868;:</p>
<table style="text-align:center">
<tr style="font-weight:700"><th>&#x683C;&#x5F0F;&#x7B26;&#x53F7;</th><th>&#x8F6C;&#x6362;</th></tr>
<tr><td>%%</td><td>&#x8F93;&#x51FA; % &#x53F7; </td></tr>
<tr><td>%s</td><td>&#x5B57;&#x7B26;&#x4E32;</td></tr>
<tr><td>%d</td><td>&#x6709;&#x7B26;&#x53F7;&#x5341;&#x8FDB;&#x5236;&#x6574;&#x6570;</td></tr>
<tr><td>%f</td><td>&#x6D6E;&#x70B9;&#x6570;</td></tr>
<tr><td>%c</td><td>&#x5B57;&#x7B26;</td></tr>
<tr><td>%u</td><td>&#x65E0;&#x7B26;&#x53F7;&#x5341;&#x8FDB;&#x5236;&#x6574;&#x6570;</td></tr>
<tr><td>%o</td><td>&#x516B;&#x8FDB;&#x5236;&#x6574;&#x6570;</td></tr>
<tr><td>%x</td><td>&#x5341;&#x516D;&#x8FDB;&#x5236;&#x6574;&#x6570;&#xFF08;&#x5C0F;&#x5199;&#x5B57;&#x6BCD;0x&#xFF09;</td></tr>
<tr><td>%X</td><td>&#x5341;&#x516D;&#x8FDB;&#x5236;&#x6574;&#x6570;&#xFF08;&#x5927;&#x5199;&#x5B57;&#x6BCD;0X&#xFF09;</td></tr>
<tr><td>%e</td><td>&#x79D1;&#x5B66;&#x8BA1;&#x6570;&#x6CD5;&#xFF08;&#x5C0F;&#x5199;&apos;e&apos;&#xFF09;</td></tr>
<tr><td>%E</td><td>&#x79D1;&#x5B66;&#x8BA1;&#x6570;&#x6CD5;&#xFF08;&#x5927;&#x5199;&#x201C;E&#x201D;&#xFF09;</td></tr>
<tr><td>%g</td><td>&#xFF05;f&#x548C;&#xFF05;e &#x7684;&#x7B80;&#x5199;  </td></tr>
<tr><td>%G</td><td>&#xFF05;f&#x548C;&#xFF05;E&#x7684;&#x7B80;&#x5199;</td></tr>
</table>

<h2 id="&#x4E09;&#x3001;&#x6362;&#x884C;&#x8F93;&#x51FA;">&#x4E09;&#x3001;&#x6362;&#x884C;&#x8F93;&#x51FA;</h2>
<p>&#x5728;&#x8F93;&#x51FA;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5982;&#x679C;&#x6709;\n&#x90A3;&#x4E48;&#xFF0C;&#x6B64;&#x65F6;\n&#x540E;&#x7684;&#x5185;&#x5BB9;&#x4F1A;&#x5728;&#x53E6;&#x5916;&#x4E00;&#x884C;&#x663E;&#x793A;&#x3002;</p>
<pre><code class="lang-python">print(<span class="hljs-string">&quot;1234567890-------&quot;</span>) <span class="hljs-comment"># &#x4F1A;&#x5728;&#x4E00;&#x884C;&#x663E;&#x793A;</span>
print(<span class="hljs-string">&quot;1234567890\n-------&quot;</span>) <span class="hljs-comment"># &#x4E00;&#x884C;&#x663E;&#x793A;1234567890&#xFF0C;&#x53E6;&#x5916;&#x4E00;&#x884C;&#x663E;&#x793A;-------</span>
</code></pre>
<h2 id="&#x56DB;&#x3001;&#x7EC3;&#x4E60;">&#x56DB;&#x3001;&#x7EC3;&#x4E60;</h2>
<p>&#x5728;&#x63A7;&#x5236;&#x53F0;&#x91CC;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x4FE1;&#x606F;&#x3002;</p>
<pre><code>    ==========&#x6211;&#x7684;&#x540D;&#x7247;==========
    &#x59D3;&#x540D;: chris   
    QQ:xxxxxxx
    &#x624B;&#x673A;&#x53F7;:185xxxxxx
    &#x516C;&#x53F8;&#x5730;&#x5740;:&#x4E0A;&#x6D77;&#x5E02;xxxx
    ===========================
</code></pre><h2 id="&#x4E94;&#x3001;python2&#x4E0E;python3&#x91CC;&#x7684;&#x533A;&#x522B;">&#x4E94;&#x3001;python2&#x4E0E;python3&#x91CC;&#x7684;&#x533A;&#x522B;</h2>
<p>&#x5728;python3&#x91CC;&#xFF0C;print&#x53EA;&#x80FD;&#x4F7F;&#x7528;&#x51FD;&#x6570;&#x7684;&#x65B9;&#x5F0F;&#x6765;&#x8C03;&#x7528;&#xFF0C;&#x800C;&#x5728;python2&#x91CC;&#xFF0C;print&#x53EF;&#x4EE5;&#x5F53;&#x505A;&#x4E00;&#x4E2A;&#x547D;&#x4EE4;&#x6765;&#x4F7F;&#x7528;&#x3002;</p>
<pre><code class="lang-python">print(<span class="hljs-string">&quot;hello world&quot;</span>)   <span class="hljs-comment"># &#x5728;python2&#x548C;python3&#x91CC;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;</span>
<span class="hljs-keyword">print</span> <span class="hljs-string">&quot;hello world&quot;</span>  <span class="hljs-comment"># &#x8FD9;&#x79CD;&#x5199;&#x6CD5;&#x53EA;&#x80FD;&#x5728;python2&#x91CC;&#x4F7F;&#x7528;&#xFF0C;python3&#x4E0D;&#x518D;&#x652F;&#x6301;&#x8FD9;&#x79CD;&#x5199;&#x6CD5;</span>
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="chapter10.html" class="navigation navigation-prev " aria-label="Previous page: 标识符和关键字"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="chapter12.html" class="navigation navigation-next " aria-label="Next page: 输入语句"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Python基础 -->
<!-- End of book Python基础 -->
</html>
